package g

import (
	"math"
	"testing"
)

func Test_divide(t *testing.T) {
	type args struct {
		dividend int
		divisor  int
	}
	tests := []struct {
		name string
		args args
		want int
	}{
		{"0", args{0, 1}, 0},
		{"1", args{10, 3}, 3},
		{"2", args{7, -3}, -2},
		{"3", args{math.MinInt32, -1}, math.MaxInt32},
		{"4", args{-7, -3}, 2},
		{"5", args{math.MinInt32, math.MinInt32}, 1},
		{"6", args{2147483647, 2}, 1073741823}, // Time Limit Exceeded
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			if got := divide(tt.args.dividend, tt.args.divisor); got != tt.want {
				t.Errorf("%v divide() = %v, want %v", tt.name, got, tt.want)
			}
		})
	}
}
